<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no"/>
<link href="/static/webAPP/css/reset.css" rel="stylesheet" type="text/css">
<link href="/static/webAPP/css/index.css" rel="stylesheet" type="text/css">
<script src="/static/webAPP/js/base.js"></script>
<title>桃里生鲜</title>
</head>
<style>
	.special-sale-box3{
		min-height: 160px;
	}
	.cityList{
		position: absolute;
		top: 50px;
		left: -5%;
		display: none;
		background-color: rgb(255, 255, 255);
		width: 30%;
		text-align: center;
		line-height: 36px;
	}
	.cityList a{
		display: block;
	}
	.classify-menu{
		width: 100%;
		margin-bottom: 5px;
	}
	.classify-menu-box1{
		padding-top: 5px;
		margin-top: 8px;
		margin-left: 3%;
		width: 45%;
		height: 90px;
		display: inline-block;
		background-repeat:no-repeat;
		position: relative;
		background-size:100% 100%;
		-moz-background-size:100% 100%;
	}
	.shuiguo{
		background-image: url(./images/shuiguooo\ .png);
	}
	.shucai{
		background-image: url(./images/shucai.png);
	}
	.classify-menu-img1{
		position: absolute;
		top: 23px;
		right: 7%;
	}
	.classify-menu-img1 img{
		width: 20px;
		height: 20px;
		display: inline-block;
		background-color: #fff;
		border-radius: 15px;
	}
	.classify-menu-text1{
		width: 58px;
		height: 48px;
		font-size: 6vw;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 48px;
		margin-left: 6%;
	}
	.classify-menu-text2{
		width: 78px;
		height: 30px;
		font-size: 4.4vw;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 30px;
		margin-left: 6%;
	}
	.brand-text2{
		font-size: 12px;
		color: #999999;
		float: right;
		line-height: 40px;
	}
	.sousuo_txt{
		width: 65%;
		height: 37px;
		background-color: #eee;
		border-radius: 50px;
		text-indent: 2em;
		text-align: center;
		float: right;
		margin-right: 5%;
		margin-top: 3px;
	}
	.fresh-topimg_1{
		background-image: url(./images/dingwi.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
		display: inline-block;
		margin-left: 3%;
		width: 10px;
		height: 12px;
	}
	/* 加载全部商品的样式 */
	.discounts-bigbox{width: 100%;float: left;margin-top: 10px;padding-bottom: 60px;background-color: #F6F6F6;}
	.discounts-bottom{width: 100%;height: 50px;line-height: 50px;background: #fff;position: fixed;bottom: 0px;left: 0px;
	border-top: 1px solid #F4F4F4;}
	/* 商品列表盒子 */
	.discounts-box1{
		width: 47%;
		min-width: 140px;
		margin: 10px 0 0 2%;
		float: left;
		height: 200px;
		background-color: #fff;
		position: relative;
		border-radius: 5px;
		-webkit-border-radius: 5px;
		-moz-border-radius: 5px;
		-ms-border-radius: 5px;
		-o-border-radius: 5px;
	}
	.d-box1-img1{
	width: 98px;
	height: 104px;
	float: left;
	text-align: center;
	margin-left: 15%;
	}
	.d-box1-img1 img{
		width: 105px;
		display: inline-block;
		margin-top: 12px;
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%,-96%);
		-webkit-transform: translate(-50%,-96%);
		-moz-transform: translate(-50%,-96%);
		-ms-transform: translate(-50%,-96%);
		-o-transform: translate(-50%,-96%);
	}


	.discounts-box2{display: block;height: 90px;margin-top: 10px;float: left;margin-left: 15%;width: 100%;}
	.d-box2-text1{
	width: 90%;
	float: left;
	height: 25px;
	line-height: 25px;
	font-weight: Bold;
	font-size: 16px;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-top: 5px;
	}
	.d-box2-text2{
	width: 95%;
	float: left;
	margin-top: 5px;
	font-size: 12px;
	color: #9D9D9D;
	}
	.d-box2-text3{
	width: 95%;
	float: left;
	font-weight: Bold;
	font-size: 15px;
	margin-top: 5px;
	color: #EE1336;
	}
	.d-box2-btn{
	float: left;
	height: 25px;
	line-height: 25px;
	border:none;
	outline: none;
	color: #fff;
	font-size: 14px;
	position: absolute;
	bottom: 16px;
	right: 12%;
	}
	.d-box2-btn img{width: 25px; margin-top: 5px;}

	/* 秒杀样式 */
.classify-kill{
	width: 94%;
	margin: 10px 3%;
	background-color: #fff;
	border-radius: 10px;
	float: left;
}
.classify-kill-img{
      float: left;
      width: 96%;
	  margin-left: 2%;
	  margin-top: 6px;
   }
   .classify-kill-img img{
      width: 100%;
      height: 100%;
   }
   .classify-kill-box{
	   float: left;
	   width: 100%;
		position: relative;
   }
   .classify-kill-box1{
	   min-width: 64px;
	   max-width: 200px;
	   float: left;
	   width: 40%;
		border-radius: 10px;
   }
   .classify-kill-box1 img{
	   width: 90%;
	   margin-left: 5%;
   }
   .classify-kill-box2{
	   float: left;
   }
   .classify-kill-box2-title{
		min-width: 90px;
		height: 30px;
		font-size: 16px;
		font-weight: 800;
		color: #000012;
		line-height: 30px;
   }
   .classify-kill-box2-count{
		width: 103px;
		height: 30px;
		font-size: 12px;
		font-weight: 500;
		color: #FF586D;
		line-height: 30px;
   }
   .classify-kill-box2-price{
		width: 89px;
		height: 30px;
		font-size: 15px;
		color: #FF6000;
		line-height: 30px;
   }
   .classify-kill-box2-price span{
	   	color: #ccc;
		text-decoration:line-through;
		padding-left: 5px;
		font-size: 12px;
   }
   .kill-btn{
		background-image: linear-gradient(#e94242, #ee936f);
		width: 86px;
		height: 30px;
		line-height: 30px;
		color: #fff;
		border-radius: 50px;
		text-align: center;
		position: absolute;
		bottom: 10px;
		right: 10px;
   }

   /* 拼团样式 */
	.classify-bulk{width: 96%;float: left;height: 38px;text-align: center;background: #fff;margin: 5px 2% 0;position: relative;background-color:transparent;color: #fff;}
	.bulk-text1{font-size: 18px;line-height: 45px;float: left;font-weight: bold;margin-left: 5px;}
	.bulk-img1{width: 18px;height: 18px;background: url(../images/arrow-right.png) no-repeat center center;
	background-size: 100%;vertical-align: middle;margin: 12px 10px 0 0;float: right;}
	.bulk-text2{
		font-size: 12px;
		float: right;
		line-height: 40px;
	}
	.classify-bulk-info{
		width: 96%;
		margin: 10px 2%;
		float: left;
	}
	.classify-bulk-box{
		width: 31%;
		margin: 0px 1%;
		background-color: #fff;
		border-radius: 10px;
		float: left;
		box-shadow: 1px 1px 1px #888888;
	}
	.classify-bulk-box1-img{
		width: 80%;
		margin-left: 10%;
		min-height: 80px;
		float: left;
	}
	.classify-bulk-box1-img img{
		width: 100%;
	}
	.classify-bulk-box1{
		float: left;
	}
	.classify-bulk-box2-text1{
		min-width: 90px;
		width: 90%;
		display: inline-block;
		margin-left: 5%;
		height: 30px;
		font-size: 16px;
		font-weight: 800;
		color: #000012;
		line-height: 30px;
		overflow: hidden;
		display: block;
	}
	.classify-bulk-box2-text2{
		width: 45%;
		margin-left: 5%;
		height: 30px;
		font-size: 14px;
		color: #FF6000;
		line-height: 30px;
	}
	.classify-bulk-box2-text3{
		height: 30px;
		font-size: 12px;
		padding-left: 5px;
		color: #ccc;
		line-height: 30px;
		text-decoration:line-through;
	}
	.bulk-btn{
		background-image: linear-gradient(#e94242, #ee936f);
		width: 80%;
		margin-left: 10%;
		height: 30px;
		line-height: 30px;
		color: #fff;
		border-radius: 50px;
		text-align: center;
		float: left;
		margin-bottom: 5px;
	}
	.classify-bulk img{
      width: 100%;
	  position: absolute;
	  top: 0px;
	  left: 0px;
	  z-index: -1;
   }
   .beijing{
		width: 100%;
		position: absolute;
		top: 0px;
		left: 0px;
		z-index: -1;
   }
   .yx-index-top{
	background-color: #FF970E;
   }
   #slideBox{
	   width: 94%;
	   margin-left: 3%;
	   border-radius: 10px;
   }
</style>
<body>
<div class="near-box">
	<img class="beijing" src="./images/tuyuan.png" alt="">
      <!--头部开始-->
	  <div class="yx-index-top">
	  	
	  	<a class="index-top-box2">
			<span class="fresh-topimg_1"></span>
				<span class="fresh-toptext1" style="color: #FFF;">正在定位...</span>
				<span class="fresh-topimg1"></span>
		</a>
		<div class="cityList" data-click="false">
			<a href="javascript:void(0);" citycodeId="127">合肥市</a>
            <a href="javascript:void(0);"citycodeId="129">芜湖市</a>
            <a href="javascript:void(0);"citycodeId="190">宣城市</a>
		</div>
		<a href="/static/webAPP/search.html">
			<input type="text" placeholder="搜索商品名称..." name="" class="sousuo_txt">
		</a>
	  	 <!-- <a href="/static/webAPP/search.html" class="index-top-box1">
	  	 	<span class="index-top-img1"><img src="/static/webAPP/images/search3.png" alt=""></span>
	  	 	<span class="index-top-text1">搜索</span>
	  	 </a> -->
	  </div>
	  <!--头部结束-->
      <div class="index-bigbox">
		  <!--轮播开始-->
		  <div id="slideBox" class="slideBox">
			<div class="bd" id="bd">
				<ul class="banerInfo">
					<li><div style="height: 150px;color: gray;">正在加载</div></li>
				</ul>
			</div>
			<div class="hd">
				<ul></ul>
			</div>
		  </div>
		  <!--轮播开始-->
		  <!--分类导航开始-->
          <div class="classify-menu">
			<a href="./discounts.html?discounts=23&discountsName=生鲜水果" class="classify-menu-box1 shuiguo">
				<span class="classify-menu-text1">优质水果</span>
				<br>
				<span class="classify-menu-text2">精品 新鲜</span>
				<span class="classify-menu-img1"><img src="./images/arrow-right.png" alt=""></span>
			</a>
			<a href="./discounts.html?discounts=16&discountsName=绿色蔬菜" class="classify-menu-box1 shucai">
			<span class="classify-menu-text1">优质蔬菜</span>
			<br>
				<span class="classify-menu-text2">价廉 物美</span>
				<span class="classify-menu-img1"><img src="./images/arrow-right.png" alt=""></span>
	   		</a>  
          	  
          </div>
		  <!--分类导航结束-->
		  <!-- 秒杀商品开始 -->
		  <div class="classify-kill">
			<div class="classify-kill-img">
				<img src="./images/miaosha.png" alt="">
			</div>

			<div class="classify-kill-box">
				<div class="classify-kill-box1">
					<img src="./images/img/西红柿 (2).jpg" alt="">
				</div>
				<div class="classify-kill-box2">
					<div class="classify-kill-box2-title">阿克苏苹果</div>
					<div class="classify-kill-box2-count">已售20份 剩余12份</div>
					<div class="classify-kill-box2-price">￥14.5<span>20.5</span></div>
				</div>
				<div class="kill-btn">马上抢</div>
			</div>
			<div class="classify-kill-box">
				<div class="classify-kill-box1">
					<img src="./images/img/西红柿 (2).jpg" alt="">
				</div>
				<div class="classify-kill-box2">
					<div class="classify-kill-box2-title">阿克苏苹果</div>
					<div class="classify-kill-box2-count">已售20份 剩余12份</div>
					<div class="classify-kill-box2-price">￥14.5<span>20.5</span></div>
				</div>
				<div class="kill-btn">马上抢</div>
			</div>
			<div class="classify-kill-box">
				<div class="classify-kill-box1">
					<img src="./images/img/西红柿 (2).jpg" alt="">
				</div>
				<div class="classify-kill-box2">
					<div class="classify-kill-box2-title">阿克苏苹果</div>
					<div class="classify-kill-box2-count">已售20份 剩余12份</div>
					<div class="classify-kill-box2-price">￥14.5<span>20.5</span></div>
				</div>
				<div class="kill-btn">马上抢</div>
			</div>

		  </div>
		  <!-- 秒杀商品结束 -->
		  <!-- 拼团商品开始 -->
		  <a href="./labelIdgoods.html?labelIdgoods=9" class="classify-bulk">
					<span class="bulk-text1">拼着买才划算</span>
					<span class="bulk-img1"></span>
					<span class="bulk-text2">进去逛逛</span>
					<img src="./images/pingtuan.png" alt="">
			</a>
			<div class="classify-bulk-info">

				<div class="classify-bulk-box">
					<a href="./goods-details.html?id='+ data[i].id +'" class="classify-bulk-box1-img">
						<img src="./images/img/西红柿 (2).jpg" alt="">
					</a>
					<div class="classify-bulk-box1" cid="'+ data[i].id +'" specificationsid="'+ data[i].specification_id +'">
						<a href="./goods-details.html?id='+ data[i].id +'" class="classify-bulk-box2-text1">阿克苏苹果</a>
						<span class="classify-bulk-box2-text2">￥14.5</span>
						<span class="classify-bulk-box2-text3">20.5</span>
					</div>
					<a href="javascript:void(0);" class="bulk-btn">去拼单</a>
				</div>
				<div class="classify-bulk-box">
					<a href="./goods-details.html?id='+ data[i].id +'" class="classify-bulk-box1-img">
						<img src="./images/img/西红柿 (2).jpg" alt="">
					</a>
					<div class="classify-bulk-box1" cid="'+ data[i].id +'" specificationsid="'+ data[i].specification_id +'">
						<a href="./goods-details.html?id='+ data[i].id +'" class="classify-bulk-box2-text1">阿克苏苹果</a>
						<span class="classify-bulk-box2-text2">￥14.5</span>
						<span class="classify-bulk-box2-text3">20.5</span>
					</div>
					<a href="javascript:void(0);" class="bulk-btn">去拼单</a>
				</div>
				<div class="classify-bulk-box">
					<a href="./goods-details.html?id='+ data[i].id +'" class="classify-bulk-box1-img">
						<img src="https://vm.fowotek.com/'+ getSmallUrl(data[i].picture_url) +'" alt="">
					</a>
					<div class="classify-bulk-box1" cid="'+ data[i].id +'" specificationsid="'+ data[i].specification_id +'">
						<a href="./goods-details.html?id='+ data[i].id +'" class="classify-bulk-box2-text1">阿克苏苹果</a>
						<span class="classify-bulk-box2-text2">￥14.5</span>
						<span class="classify-bulk-box2-text3">20.5</span>
					</div>
					<a href="javascript:void(0);" class="bulk-btn">去拼单</a>
				</div>
			</div>
			
		  <!-- 拼团商品结束 -->
		  <!--优选水果开始-->
		  <a href="/static/webAPP/labelIdgoods.html?labelIdgoods=9" class="brand-box1">
				<span class="brand-text1"><img src="./images/jvhuasuan.png">聚划算</span>
				<span class="brand-img1"></span>
				<span class="brand-text2">进去看看</span>
		  </a>
		  <div class="special-sale-box3 jvhuasuan_info1">
			正在加载
		  </div>
		  <!--优选水果结束-->
		  <!--酒水饮料开始-->
		  <a href="/static/webAPP/labelIdgoods.html?labelIdgoods=2" class="brand-box1">
				<span class="brand-text1"><img src="./images/shiling.png">时令</span>
				<span class="brand-img1"></span>
				<span class="brand-text2">进去看看</span>
		  </a>
		  <div class="special-sale-box3 jvhuasuan_info2">
			正在加载
		  </div>
		  <!--酒水饮料结束-->
		  <!--休闲零食开始-->
		  <a href="/static/webAPP/labelIdgoods.html?labelIdgoods=4" class="brand-box1">
		  	  <span class="brand-text1"><img src="./images/renqi.png">人气商品</span>
		  	  <span class="brand-img1"></span>
				<span class="brand-text2">进去看看</span>
		  </a>
		  <div class="special-sale-box3 jvhuasuan_info3">
			正在加载
		  </div>
		  <!--休闲零食结束-->
          
	  </div>
	  <div class="allGoods" style="float: left;">

	</div>
      <!--bigbox结束-->
      <div class="kaola-bottom">
		<a href="/static/webAPP/index.html" class="kaola-bottom-box1">
			<span class="kaola-bottom-img1"><img src="/static/webAPP/images/home.png"></span>
			<span class="kaola-bottom-text1 text2">首页</span>
		</a>
		<a href="/static/webAPP/classify.html" class="kaola-bottom-box1">
			<span class="kaola-bottom-img1"><img src="/static/webAPP/images/fenlei1.png"></span>
			<span class="kaola-bottom-text1">分类</span>
		</a>
		<a href="/static/webAPP/shoping-cart.html" class="kaola-bottom-box1">
			<span class="kaola-bottom-img1"><img src="/static/webAPP/images/shop-cart1.png"></span>
			<span class="kaola-bottom-text1">购物车</span>
		</a>
		<a href="/static/webAPP/personal-center.html" class="kaola-bottom-box1">
			<span class="kaola-bottom-img1"><img src="/static/webAPP/images/people1.png"></span>
			<span class="kaola-bottom-text1">我的</span>
		</a>
	</div>
</div>
<!-- <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script> -->
<script src="/static/webAPP/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/static/webAPP/js/TouchSlide.1.1.js"></script>
<script type="text/javascript" src="/static/webAPP/js/scrolltopcontrol.js"></script>
<script src="/static/webAPP/lib/mobile/layer.js"></script>
<script>
	$.ajax({
		type: "get",
						//TODO:
		url: "/app/commodityInfo/getSaleAdvertisement",
		data: {pageNum: 1,pageSize: 10},
		async:false,
		dataType: "json",
		success: function(mag){
			var tag = ''
			// console.log(mag)
			var data = mag.data.list
			for (let i = 0; i < data.length; i++) {
				var tag1 = '<li><a class="pic" href="./goods-details.html?id='+ data[i].commodity_id +'"><img src="https://vm.fowotek.com/'+ data[i].picture_url +'"/></a></li>'
				tag += tag1
			}
			$(".banerInfo").html(tag)
		}
	})
	TouchSlide({ 
			slideCell:"#slideBox",
			titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
			mainCell:".bd ul", 
			effect:"leftLoop", 
			autoPage:true,//自动分页
			autoPlay:true, //自动播放
		});
</script>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=DouIq9pM7lqTiVOnzOQ6Q8biwgi2GIM0&s=1">
	//v2.0版本的引用方式：src="http://api.map.baidu.com/api?v=2.0&ak=您的密钥"
	</script>
<script>
	$(function(){
		var pagenum,goodstag
		var userName = sessionStorage.getItem("sessionName")
		var city = sessionStorage.getItem("city")
		var areaId = sessionStorage.getItem("citycode")
		$(".fresh-toptext1").html(city)
		if (areaId != '' && areaId != undefined && areaId != null) {
			ByLabelIdfun(areaId)
			goodstag = ''
			pagenum = 1
			$(".allGoods").html('')
			$(window).unbind("scroll").bind("scroll", function(){
				var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
				var positionValue = (scrollTop + windowHeight) - scrollHeight;
				if (positionValue >= -1) {
					if (pagenum != 10000) {
						goodsList(areaId,pagenum)
					}
				}
			});
		}

		var userAgent = navigator.userAgent.toLowerCase();
		if(userAgent.match(/MicroMessenger/i) == "micromessenger") {
			if (userName == null || userName == '' || userName == undefined) {
				window.location = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx45db0b3d36e1f241&redirect_uri=https%3A%2F%2F"+ document.domain +"%2Fstatic%2FwebAPP%2Fweichatlogin.html&response_type=code&scope=snsapi_userinfo&#wechat_redirect";
			}
		}else{
			if (areaId == null || areaId == '' || areaId == undefined) {
				var geolocation = new BMap.Geolocation();
				geolocation.getCurrentPosition(function(r){
					if(this.getStatus() == BMAP_STATUS_SUCCESS){
						$.ajax({
							url:'https://api.map.baidu.com/geocoder/v2/?ak=Ya2nSaqjT3vNrIgba1v4nfWzSxGdtgZD&location=' + r.point.lat + ',' + r.point.lng + '&output=json&pois=1&s=1',
							dataType: "jsonp",
							callback: 'BMap._rd._cbk43398',
							success: function(mag){
								var city = mag.result.addressComponent.city
								var areaId = mag.result.cityCode
								sessionStorage.setItem("citycode", areaId);
								sessionStorage.setItem("city", city);
								$(".fresh-toptext1").html(city)
								ByLabelIdfun(areaId)
								goodstag = ''
								pagenum = 1
								$(".allGoods").html('')
								$(window).unbind("scroll").bind("scroll", function(){
									var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
									var positionValue = (scrollTop + windowHeight) - scrollHeight;
									if (positionValue >= -1) {
										if (pagenum != 10000) {
											goodsList(areaId,pagenum)
										}
									}
								});
							},
							error:function(){
								layer.open({
									content: '定位失败,默认为合肥市',
									skin: 'msg',
									time: 3 //2秒后自动关闭
								});
								sessionStorage.setItem("citycode", '127');
								sessionStorage.setItem("city", '合肥市');
								$(".fresh-toptext1").html(合肥市)
								ByLabelIdfun(127)
								goodstag = ''
								pagenum = 1
								$(".allGoods").html('')
								$(window).unbind("scroll").bind("scroll", function(){
									var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
									var positionValue = (scrollTop + windowHeight) - scrollHeight;
									if (positionValue >= -1) {
										if (pagenum != 10000) {
											goodsList(127,pagenum)
										}
									}
								});
							}
						})
					}
					else {
						layer.open({
							content: '定位失败,默认为合肥市',
							skin: 'msg',
							time: 3 //2秒后自动关闭
						});
						sessionStorage.setItem("citycode", '127');
						sessionStorage.setItem("city", '合肥市');
						$(".fresh-toptext1").html(合肥市)
						ByLabelIdfun(127)
						goodstag = ''
						pagenum = 1
						$(".allGoods").html('')
						$(window).unbind("scroll").bind("scroll", function(){
							var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
							var positionValue = (scrollTop + windowHeight) - scrollHeight;
							if (positionValue >= -1) {
								if (pagenum != 10000) {
									goodsList(127,pagenum)
								}
							}
						});
					}        
				},{enableHighAccuracy: true})
			}else{
				$(".fresh-toptext1").html(city)
				ByLabelIdfun(areaId)
				goodstag = ''
				pagenum = 1
				$(".allGoods").html('')
				$(window).unbind("scroll").bind("scroll", function(){
					var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
					var positionValue = (scrollTop + windowHeight) - scrollHeight;
					if (positionValue >= -1) {
						if (pagenum != 10000) {
							goodsList(areaId,pagenum)
						}
					}
				});
			}
		}
		
		
		$(".index-top-box2").click(function(){
			var oClickName = $(this).attr('data-click');
			if(oClickName=='true'){
			$(this).siblings('div').slideUp(300);
			$(this).attr('data-click','false')
			}else{
			$(this).siblings('div').slideDown(300);
			$(this).attr('data-click','true')
			}
		})
		$(".cityList").children("a").click(function(){
			var city = $(this).html()
			var citycode = $(this).attr("citycodeId")
			sessionStorage.setItem("citycode", citycode);
			sessionStorage.setItem("city", city);
			$(".cityList").slideUp(300);
			$(".index-top-box2").attr('data-click','false')
			$(".fresh-toptext1").html(city)
			ByLabelIdfun(citycode)
			
			goodstag = ''
			pagenum = 1
			$(".allGoods").html('')
			$(window).unbind("scroll").bind("scroll", function(){
				var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
				var positionValue = (scrollTop + windowHeight) - scrollHeight;
				
				if (positionValue >= -1) {
					if (pagenum != 10000) {
						goodsList(citycode,pagenum)
					}
				}
			});
		})

		$(document).on('click','.d-box2-btn',function(){
			var id = $(this).closest(".discounts-box2").attr("cid")
			var userId = sessionStorage.getItem("sessionUserid")
			if (userId == '' || userId == undefined || userId == null) {
				layer.open({
					content: '用户未登录',
					skin: 'msg',
					time: 2 //2秒后自动关闭
				});
			}
			var specificationsid = $(this).closest(".discounts-box2").attr("specificationsid")
			$.ajax({
				type: "post",
						//TODO:
				url: "/app/basket/addCommodityToBasket",
				data: {commodity_id: id,commodity_specification_id: specificationsid,count: 1,user_id: userId},
				dataType: "json",
				success: function(res){
					layer.open({
						content: res.message,
						skin: 'msg',
						time: 2 //2秒后自动关闭
					});
				},
				error: function(){
					layer.open({
						content: '商品信息错误，请联系客服',
						skin: 'msg',
						time: 2 //2秒后自动关闭
					});
				}
			})
		})

		function goodsList(areaId,num) {
			$.ajax({
				type: "get",
								//TODO:
				url: "/app/commodityInfo/getCommodityInfoList2/"+ areaId +"/"+ num,
				data: '',
				async:false,
				dataType: "json",
				success: function(mag){
					var data = mag.data.list
					for (let i = 0; i < data.length; i++) {
						var tag1 = '<div class="discounts-box1"><a href="./goods-details.html?id='+ data[i].id +'" class="d-box1-img1"><img src="https://vm.fowotek.com/'+ getSmallUrl(data[i].picture_url) +'" alt=""></a><div class="discounts-box2" cid="'+ data[i].id +'" specificationsid="'+ data[i].specification_id +'"><a href="./goods-details.html?id='+ data[i].id +'" class="d-box2-text1">'+ data[i].commodityName +'</a><span class="d-box2-text2">'+ data[i].specifications +'</span><span class="d-box2-text3">￥'+ data[i].price +'</span><a href="javascript:void(0);" class="d-box2-btn"><img src="./images/gouwuchee.png"></a></div></div>'
						goodstag += tag1
					}
					if (data.length == 10) {
						pagenum++
						$(".allGoods").html(goodstag)
					}else{
						pagenum = 10000
						$(".allGoods").html(goodstag + '<div style="text-align: center;color: #ccc;width:100%;float:left;margin-bottom: 50px;">已加载全部商品</div>')
					}
				}
			})
		}

		function ByLabelIdfun(areaId){
			var tag_1 = ''
			var tag_2 = ''
			var tag_3 = ''
			$.ajax({
				type: "get",
								//TODO:
				url: "/app/commodityInfo/getIndexFloor2/3/"+ areaId ,
				data: '',
				// async:false,
				dataType: "json",
				success: function(mag){
					var data = mag.data
					for (let j = 0; j < data.length; j++) {
						if (data[j].id == 9) {
							var data1 = data[j].commodityListInfos
							for (let i = 0; i < data1.length; i++) {
								var tag1 = '<div class="special-sale-box4"><a href="./goods-details.html?id='+ data1[i].id +'"><span class="special-sale-img1"><img src="https://vm.fowotek.com/'+ getSmallUrl(data1[i].picture_url) +'" alt=""></span><span class="special-sale-tbox">'+ data1[i].commodityName +'</span><div class="special-sale-tbox2">'+ data1[i].specifications +'</div><span class="special-sale-text2">￥'+ data1[i].price +'</span></a></div>'
								tag_1 += tag1
							}
						$(".jvhuasuan_info1").html(tag_1)
						}
						if (data[j].id == 2) {
							var data1 = data[j].commodityListInfos
							for (let i = 0; i < data1.length; i++) {
								var tag1 = '<div class="special-sale-box4"><a href="./goods-details.html?id='+ data1[i].id +'"><span class="special-sale-img1"><img src="https://vm.fowotek.com/'+ getSmallUrl(data1[i].picture_url) +'" alt=""></span><span class="special-sale-tbox">'+ data1[i].commodityName +'</span><div class="special-sale-tbox2">'+ data1[i].specifications +'</div><span class="special-sale-text2">￥'+ data1[i].price +'</span></a></div>'
								tag_2 += tag1
							}
						$(".jvhuasuan_info2").html(tag_2)
						}
						if (data[j].id == 4) {
							var data1 = data[j].commodityListInfos
							for (let i = 0; i < data1.length; i++) {
								var tag1 = '<div class="special-sale-box4"><a href="./goods-details.html?id='+ data1[i].id +'"><span class="special-sale-img1"><img src="https://vm.fowotek.com/'+ getSmallUrl(data1[i].picture_url) +'" alt=""></span><span class="special-sale-tbox">'+ data1[i].commodityName +'</span><div class="special-sale-tbox2">'+ data1[i].specifications +'</div><span class="special-sale-text2">￥'+ data1[i].price +'</span></a></div>'
								tag_3 += tag1
							}
						$(".jvhuasuan_info3").html(tag_3)
						}
					}
				}
			})
		}
	})
</script>
</body>
</html>